package lianxi;

public class _09_ {

	public static void main(String[] args) {
		Student s1 = new Student("小明", "男");
		Student s2 = new Student("小红", "女");
		Teacher t1 = new Teacher("孙老师", "男");
		Teacher t2 = new Teacher("王老师", "女");
		Instructor i = new Instructor("张三", "男");
		s1.setTeacher(t2);
		s2.setTeacher(t1);
		s1.setTnstructor(i);
		s2.setTnstructor(i);
		System.out.println(s1);
		System.out.println(s2);
		System.out.println(s1.getDailyWork());
		System.out.println(s2.getDailyWork());
		System.out.println(t1.getDailyWork());
		System.out.println(t2.getDailyWork());
		System.out.println(i.getDailyWork());
		
	}

}

abstract class Person {
	String name;
	String sex;

	public Person(String name, String sex) {
		super();
		this.name = name;
		this.sex = sex;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	abstract String getDailyWork();
}

class Student extends Person {
	Teacher teacher;
	Instructor tnstructor;

	public Teacher getTeacher() {
		return teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public Instructor getTnstructor() {
		return tnstructor;
	}

	public void setTnstructor(Instructor tnstructor) {
		this.tnstructor = tnstructor;
	}

	public Student(String name, String sex) {
		super(name, sex);
	}

	@Override
	String getDailyWork() {
		return "我是 : " + name + ", 我在学习 !!";
	}

	@Override
	public String toString() {
		return "Student [name=" + name + ", sex=" + sex + ", teacher=" + teacher + ", tnstructor=" + tnstructor + "]";
	}

}

class Teacher extends Person {

	public Teacher(String name, String sex) {
		super(name, sex);
	}

	@Override
	String getDailyWork() {

		return "我是 : " + name + ", 我在给学生讲课 !!";
	}

	@Override
	public String toString() {
		return "Teacher [name=" + name + ", sex=" + sex + "]";
	}

}

class Instructor extends Person {

	public Instructor(String name, String sex) {
		super(name, sex);
	}

	@Override
	String getDailyWork() {
		return "我是 : " + name + ", 我在辅导学生 !!";
	}

	@Override
	public String toString() {
		return "Instructor [name=" + name + ", sex=" + sex + "]";
	}

}